package com.xt.yncu.login.dao;

import java.util.List;

import com.xt.base.model.base.Organization;
import com.xt.base.model.system.User;
import com.xt.yncu.common.dao.BaseXtDao;

/**
 *  <br>
 * <br>
 * 
 * <p>
 * <a href=".java.html"><i>查看源文件</i></a>
 * </p>
 * 
 * @author 杨洪波
 * @create-date:2011-11-3
 */
public class LoginMobileDao extends BaseXtDao{
	private static final long serialVersionUID = 1410228751214509318L;

	@SuppressWarnings("unchecked")
	public Organization getOrgByOrgid(String orgId){
		String hql = "from Organization o where o.code=:orgid";
		List list = this.getSession().createQuery(hql)
					.setString("orgid", orgId).list();
		if(list==null || list.isEmpty()){
			return null;
		}
		return (Organization)list.get(0);
	}
	
	@SuppressWarnings("unchecked")
	public User getUserByUserid(String userid){
		String hql = "from User u where u.code=:userid";
		List list = this.getSession().createQuery(hql)
					.setString("userid", userid).list();
		if(list==null || list.isEmpty()){
			return null;
		}
		return (User)list.get(0);
	}
}
